package com.aiyige.model.request;

import com.aiyige.MyApp;
import com.aiyige.R;
import com.aiyige.model.eshop.Order;

/**
 * Created by xiachao on 2017/11/17.
 */

public enum OrderStatusEnum {
    STATUS_0_NOPAY(Order.Status.UNPAY, MyApp.getAppContext().getString(R.string.order_status_nopay)),
    STATUS_1_PAYED(Order.Status.PAYED,MyApp.getAppContext().getString(R.string.order_status_payed)),
    STATUS_2_CANCEL(Order.Status.CANCELED,MyApp.getAppContext().getString(R.string.order_status_cancel)),
    STATUS_3_WAITING_SHIP(Order.Status.UNSHIPPING,MyApp.getAppContext().getString(R.string.order_status_waiting_ship)),
    STATUS_4_WAITING_AFFIRM(Order.Status.UNCONFIRM,MyApp.getAppContext().getString(R.string.order_status_waiting_affirm)),
    STATUS_5_CONFIRMED(Order.Status.CONFIRMED,MyApp.getAppContext().getString(R.string.order_status_confirmed)),
    STATUS_6_SALES_RETURN(Order.Status.TOREFUND,MyApp.getAppContext().getString(R.string.order_status_sales_return)),
    STATUS_7_HAVE_TO_RETURN(Order.Status.RETURNED,MyApp.getAppContext().getString(R.string.order_status_have_to_return));

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    private int status;
    private String value;

    OrderStatusEnum(int status, String value) {
        this.status = status;
        this.value = value;

    }


    /**
     * 根据key获取value
     *
     * @param key
     *            : 键值key
     * @return String
     */
    public static String getValueByKey(int key) {
        OrderStatusEnum[] enums = OrderStatusEnum.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getStatus() == key) {
                return enums[i].getValue();
            }
        }
        return "";
    }


}
